<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>详情信息</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/lib/layui/css/layui.css">
</head>
<body>
    <div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<table id="financeTable" lay-filter="financeTable"></table>
			</div>
		</div>
	</div>
</body>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/lib/layui/layui.all.js"></script>
<script>
var ctx = "${pageContext.request.contextPath}";
var areaId = "${areaId}";
var ticketType = "${ticketType}";
var unit = "${unit}";
var carNo = "${carNo}";

var startDate = "${startDate}";
var endDate = "${endDate}";
var unitDicDatas = eval('${unitDicDatas}');
var areaDicDatas = eval('${areaDicDatas}');
var unitDicDatas = eval('${unitDicDatas}');
function getDicVal(value,list){
	for(var i=0;i<list.length;i++){
		if(list[i].dicDataValue==value){
			return list[i].dicDataName;
		}
	}
	return "";
}

$(function(){
	var laydate = layui.laydate;
	var laytable = layui.table;
	var layer = layui.layer;
	
	var tableIns = laytable.render({
	    elem: '#financeTable'
	    ,url: ctx+'/dataAnalyze/findByDetails' //数据接口
	    ,height:350
	    ,where: {
	    	carNo:carNo,
	    	unit:unit,
	    	areaId:areaId, 
	    	ticketType:ticketType,
	    	startDate: startDate,
	    	endDate: endDate,
	    }//参数
	    ,page: true //开启分页
	    ,cols: [[ //表头
	    	/* {field: 'unit', title: '单位',templet: function(d){
		          return getDicVal(d.unit,unitDicDatas);
		      }  }
	    	, */{field: 'areaId', title: '区域',templet: function(d){
		          return getDicVal(d.areaId,areaDicDatas);
		      }  }
	    	,{field: 'carNo', title: '车牌号',templet: function(d){
		          return d.carNo;
		      } } 
	    	,{field: 'netWeight', title: '净重',templet: function(d){
		          return d.netWeight;
		      } }
	    	,{field: 'roughWeight', title: '毛重',templet: function(d){
		          return d.roughWeight;
		      } }
	      ,{field: 'createTime', title: '入场时间',templet: function(d){
	          return fromateTime(d.createTime);
	      } }
	    ]]
	  });
});

function fromateTime(TimeStr){
	if(TimeStr){
		var yyyy = TimeStr.substring(0,4);
		var month = TimeStr.substring(4,6);
		var day = TimeStr.substring(6,8);
		var hh = TimeStr.substring(8,10);
		var min = TimeStr.substring(10,12);
		var second = TimeStr.substring(12,14);
		return yyyy+"-"+month+"-"+day+" "+hh+":"+min+":"+second;
	}
	return "";
}
</script>
</html>